<?php

class OrderfieldAction extends AdminbaseAction {

	protected $dao;
    function _initialize()
    {	
		parent::_initialize();
		$this->dao=M('role');

	
    }

	function index(){

		$rid=intval($_GET['rid']);
		$alist = $this->dao->where('id = '.$rid)->find();
		$ofield=$alist['orderfield'];
		$this->assign('ofield', $alist['orderfield']);
		$this->assign('rid', $rid);	
		$this->display();
	}	
	function insert(){
		 
		$rid=$_POST['rid'];
		$nid=$_POST['ofield'];
		if(!empty($rid)){
			$node_id=implode(',',$nid);
			$data['id'] = $rid;
			$data['orderfield'] = $node_id;
			if(false!==$this->dao->save($data)){
				$this->success(L('role_ok'));
				
			}else{
				$this->error(L('role_error'));
			}
		}else{
			$this->error(L('do_empty'));
		}
	}
	
}
?>